package com.ma5d.driver.driver.controller;

import com.ma5d.driver.common.result.Result;
import com.ma5d.driver.driver.service.OcrService;
import com.ma5d.driver.model.vo.driver.IdCardOcrVo;
import com.ma5d.driver.model.vo.driver.DriverLicenseOcrVo;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/ocr")
public class OcrController {

    @Resource
    private OcrService ocrService;

    @PostMapping("/idCardOcr")
    public Result<IdCardOcrVo> idCardOcr(MultipartFile file) {
        IdCardOcrVo idCardOcrVo = ocrService.idCardOcr(file);
        return Result.ok(idCardOcrVo);
    }

    @PostMapping("/driverLicenseOcr")
    public Result<DriverLicenseOcrVo> driverLicenseOcr(MultipartFile file){
        DriverLicenseOcrVo driverLicenseVo = ocrService.driverLicenseOcr(file);
        return Result.ok(driverLicenseVo);
    }

}
